import Vue from "vue";
import Vuex from 'vuex';

Vue.use(Vuex)

export default new Vuex.Store({
    // 数据
    state: {
        insertSuccess: false,
        selectedYear: '',
        contentList: [],
        showUpload: false,
        dayList: [],
        uploadFocus: 'title'
    },
    //控制
    actions: {
        setSelectedYear(context, val) {
            context.state.selectedYear = val
        },
        setInsertSuccess(context, val) {
            context.state.insertSuccess = val
        },
        setContentList(context, val) {
            context.state.contentList = val
        },
        setShowUpload(context, val) {
            context.state.showUpload = val
        },
        contentListPush(context, val) {
            context.state.contentList.push(val)
        },
        setDayList(context, val) {
            context.state.dayList = val
        },
        dayListPush(context, val) {
            context.state.dayList.push(val)
        },
        setUploadFocus(context, val) {
            context.state.uploadFocus = val
        }
    },
    // 修改
    mutations: {},
    getters: {    },
})
